package com.mo.ld.modle

import android.widget.TextView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.mo.ld.R
import com.mo.ld.bean.ActionBean
import com.mo.ld.bean.ActionBean2
import com.mo.lib.utils.setClick

/**
 * @ author：mo
 * @ data：2022/3/26:14:21
 * @ 功能：
 */
fun getMainAdapter2(data: MutableList<ActionBean>): BaseQuickAdapter<ActionBean, BaseViewHolder> {
    return object : BaseQuickAdapter<ActionBean, BaseViewHolder>(R.layout.item_main, data) {
        override fun convert(holder: BaseViewHolder, item: ActionBean) {
            holder.getView<TextView>(R.id.tv_item_main).text = item.name
            holder.itemView.setClick {
                item.event.invoke()
            }
        }
    }
}
fun getMainAdapter3(data: MutableList<ActionBean2>): BaseQuickAdapter<ActionBean2, BaseViewHolder> {
    return object : BaseQuickAdapter<ActionBean2, BaseViewHolder>(R.layout.item_main, data) {
        override fun convert(holder: BaseViewHolder, item: ActionBean2) {
            holder.getView<TextView>(R.id.tv_item_main).text = item.name
            holder.itemView.setClick (500){
                item.event.invoke(this)
            }
        }
    }
}
fun getMainAdapter(): BaseQuickAdapter<String, BaseViewHolder> {
    return object : BaseQuickAdapter<String, BaseViewHolder>(R.layout.item_main, getData()) {
        override fun convert(holder: BaseViewHolder, item: String) {
            holder.getView<TextView>(R.id.tv_item_main).text = item
        }
    }
}

fun getData(): MutableList<String> {
    return mutableListOf(
        "张三",     "张三",     "张三",     "张三",     "张三",     "张三",     "张三",     "张三", "张三",     "张三",     "张三",     "张三",     "张三",     "张三",     "张三", "张三",     "张三",     "张三",     "张三",     "张三",     "张三",     "张三", "张三",     "张三",     "张三",     "张三",     "张三",     "张三",     "张三", "张三",     "张三",     "张三",     "张三",     "张三",     "张三",     "张三", "张三",     "张三",     "张三",     "张三",     "张三",     "张三",     "张三",
    )

}
